﻿package bakudo.engines.mapEngine.model.actors 
{
	import bakudo.engines.mapEngine.view.scene.actors.SceneActor;
	import flash.display.Bitmap;
	import flash.display.BitmapData;
	import flash.display.DisplayObject;
	import flash.display.DisplayObjectContainer;
	import flash.filters.ColorMatrixFilter;
	import flash.geom.ColorTransform;
	import flash.geom.Matrix;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	import flash.utils.getDefinitionByName;
	import flash.utils.getQualifiedClassName;
	
	/**
	 * ...
	 * @author Bakudo
	 */
	public class ModelActor 
	{
		
	
		/** Referencja do widoku */
		public var view : SceneActor;
	
		/** Pozycja aktora w strukturze modelu */
		public var position : Point = new Point();
		
		/** Nazwa klasy przypisanej do widoku */
		public var viewClassName : String;
		
		/** Typ aktora */
		public var type : String;
		
		public function ModelActor(setType:String = null) {
			position.x = -1;
			position.y = -1;
			type = setType ? setType : null;
		}
		
		
		
	//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
	// PUBLIC METHODS
	//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
	
		/**
		 * Zwraca widok
		 * @return widok w formacie BitmapData
		 */
		public function getView():BitmapData {
			var bd : BitmapData = new BitmapData(view.width, view.height, true, 0x00000000);
			bd.draw(view);
			return bd;
		}
		
		/**
		 * Zwraca obszar zajmowany przez widok
		 * @return obszar widoku w formacie Rectangle
		 */
		public function getViewBoundary():Rectangle {
			return new Rectangle(position.x, position.y, view.width, view.height);
		}
	}
}